import pyautogui
import time

##魔女的回忆
def autoclick():
    pyautogui.PAUSE = 1
   
    while True:
        try:
            btnx=pyautogui.locateOnScreen('shuajinbi/xingxing.png')
            pyautogui.click()           
        except:
            pass
        if btnx:
            print('结束')
            break        
        
    print('点击了')
    while True:
        try:
            btn1=pyautogui.locateOnScreen('shuajinbi/zailai.png')
            pyautogui.moveTo(pyautogui.center(btn1),duration=0.5)
            pyautogui.click(pyautogui.center(btn1))
            print('再来')

        except:
            pass
        if btn1:
            pyautogui.moveTo(500,300,duration=0.5)
            break

    while True:    
        try:
            btn2=pyautogui.locateOnScreen('shuajinbi/cuangguan.png')
            pyautogui.moveTo(pyautogui.center(btn2),duration=0.5)
            pyautogui.click(pyautogui.center(btn2))
            print('闯关')

        except:
            pass
        if btn2:
            pyautogui.moveTo(500,300,duration=0.5)
            break
    autoclick()

if __name__=='__main__':
    autoclick()
